#ifndef SNAKEL_H
#define SNAKEL_H

#include <QMainWindow>
#include<qpainter.h>
#include<QVector>
#include<qstring.h>

QT_BEGIN_NAMESPACE
namespace Ui { class snakel; }
QT_END_NAMESPACE

class snakel : public QMainWindow
{
    Q_OBJECT

public:
    explicit snakel(QWidget *parent = nullptr);
    ~snakel();
    void paintEvent(QPaintEvent *event);
    void InitSnake();//初始化蛇1
    QRect CreatRect();
    QRect CreatRect2();
    void IsEat();
    void IsHit();

private slots:
    void Snake_update()
;
private:
    Ui::snakel *ui;
    QVector<QRect> vSnakeRect;//蛇1
    QRect Snakehead;//蛇头1
    void keyPressEvent(QKeyEvent *key);
    QTimer *timer;//定时器
    bool blsRun;//是否开始
    bool blsOver;//是否结束
    QString sDisplay;
    int nDirection;//蛇1移动的方向
    QRect food;
    QRect boom;
    int nScore;
    QString scoreLabel;
    int speed;
};
#endif // SNAKEL_H
